/**
 * 邢帅教育
 * <p>
 * 本源代码由数据中心及其作者共同所有，未经版权持有者的事先书面授权，
 * 不得使用、复制、修改、合并、发布、分发和/或销售本源代码的副本。
 *
 * @copyright Copyright (c) 2018. [图片]xsteach.com all rights reserved.
 * @author maikec
 * @date 2018/8/15
 */

/**
 * @author maikec
 * @date 2018/8/15
 */
package chapter23;
//SpringApplicationBuilder

//Some events are actually triggered before the ApplicationContext is created, so you cannot register a listener on those
//        as a @Bean. You can register them with the SpringApplication.addListeners(…​) method or the
//        SpringApplicationBuilder.listeners(…​) method.
//
//If you want those listeners to be registered automatically, regardless of the way the application is created,
//        you can add a META-INF/spring.factories file to your project and reference your listener(s) by using
//        the org.springframework.context.ApplicationListener key, as shown in the following example:
//
//org.springframework.context.ApplicationListener=com.example.project.MyListener

//An ApplicationStartingEvent is sent at the start of a run but before any processing, except for the registration of listeners and initializers.
//An ApplicationEnvironmentPreparedEvent is sent when the Environment to be used in the context is known but before the context is created.
//An ApplicationPreparedEvent is sent just before the refresh is started but after bean definitions have been loaded.
//An ApplicationStartedEvent is sent after the context has been refreshed but before any application and command-line runners have been called.
//An ApplicationReadyEvent is sent after any application and command-line runners have been called. It indicates that the application is ready to service requests.
//An ApplicationFailedEvent is sent if there is an exception on startup.

//
//If you need to access the application arguments that were passed to SpringApplication.run(…​), you can inject a org.springframework.boot.ApplicationArguments bean. The ApplicationArguments interface provides access to both the raw String[] arguments as well as parsed option and non-option arguments, as shown in the following example:
//
//        import org.springframework.boot.*;
//        import org.springframework.beans.factory.annotation.*;
//        import org.springframework.stereotype.*;
//
//@Component
//public class MyBean {
//
//    @Autowired
//    public MyBean(ApplicationArguments args) {
//        boolean debug = args.containsOption("debug");
//        List<String> files = args.getNonOptionArgs();
//        // if run with "--debug logfile.txt" debug=true, files=["logfile.txt"]
//    }
//
//}
//[Tip]
//        Spring Boot also registers a CommandLinePropertySource with the Spring Environment. This lets you also inject single application arguments by using the @Value annotation.


//ApplicationRunner or CommandLineRunner